using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WOWEquipOptimizer
{
    /// <summary>
    /// Dialog to select buffs etc.
    /// </summary>
    public partial class BuffsDialog : Form
    {
        private Buff m_BoK = new Buff("Blessing of Kings", new List<Attribute>()); // special case, bok increases attributes by 10%
        public BuffsDialog()
        {
            InitializeComponent();
            this.BuffsListBox.Sorted = true;
            this.BuffsListBox.ValueMember = "Name";
            this.BuffsListBox.Items.Add(m_BoK);
            this.BuffsListBox.SelectedItems.Add(m_BoK);
        }
        public bool getBoKState()
        {
            if (this.BuffsListBox.SelectedItems.Contains(m_BoK)) return true;
            else return false;
        }
        public void addBuff(Buff buff)
        {
            this.BuffsListBox.Items.Add(buff);
            if(buff.Enabled) this.BuffsListBox.SelectedItems.Add(buff);
        }
        public List<Buff> getBuffs()
        {
            List<Buff> retval = new List<Buff>();
            foreach (Buff buff in this.BuffsListBox.SelectedItems)
            {
                if (buff.Name == m_BoK.Name) continue;
                retval.Add(buff);
            }
            return retval;
        }
        private void BuffsOkButton_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
    }
}